const Generator = require('yeoman-generator');

module.exports = class extends Generator {
  prompting() {
    return this.prompt([
      {
        type: 'input',
        name: 'name',
        message: 'Your project name',
        default: this.appname,
      },
    ]).then(answers => {
      this.answers = answers;
    });
  }
  writing() {
    // 把每一个文件都ton过模板转换到目标路径
    const temps = [
      'src/assets/fonts/pages.eot',
      'src/assets/fonts/pages.svg',
      'src/assets/fonts/pages.ttf',
      'src/assets/fonts/pages.woff',
      'src/assets/images/brands.svg',
      'src/assets/images/logo.png',
      'src/assets/scripts/main.js',
      'src/assets/styles/_icons.scss',
      'src/assets/styles/_variables.scss',
      'src/assets/styles/main.scss',
      'src/layouts/basic.html',
      'src/partials/footer.html',
      'src/partials/header.html',
      'src/about.html',
      'src/index.html',
      '.editorconfig',
      '.gitignore',
      '.npmrc',
      '.travis.yml',
      'gulpfile.js',
      'LICENSE',
      'package-lock.json',
      'package.json',
      'README.md',
    ];
    temps.forEach(item => {
      this.fs.copyTpl(this.templatePath(item), this.destinationPath(item), this.answers);
    });
  }
};
